package com.invengo.library_db.entity.module_check;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.invengo.library_db.BuildConfig;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Index;
import org.greenrobot.greendao.annotation.Transient;

import java.io.Serializable;

/**
 * 图书表
 */
@Entity
public class BookBean implements Serializable, Cloneable, Parcelable {
    /**
     * Serializable
     */
    private static final long serialVersionUID = 1L;
    @Id(autoincrement = true)
    @Index
    private Long Id;
    @Index
    @Expose
    @SerializedName("nLabelID")
    private String tid;
    @SerializedName("szBookCaseNo")
    @Expose
    private String shelfCode;    // 架位编码
    @SerializedName("szCaseNoTrans")
    @Expose
    private String shelfName;    // 架位名称
    @SerializedName("dtNeedBackDate")
    @Expose
    private String needBackDate;
    @Index
    @Expose
    @SerializedName("szBookID")
    private String barCode;
    @SerializedName("szName")
    @Expose
    private String bookName;    // 图书名称
    @SerializedName("szBookIndex")
    @Expose
    private String callNo;
    @SerializedName("szlibCD")
    @Expose
    private String locationName;

    @SerializedName("bForceSortCase")
    @Expose
    private boolean forceSortCase;

    @Expose(serialize = false)
    @SerializedName("szPretendIndexNum")
    private String pretendCallNo;
    private String szBookSSID;
    @Expose(serialize = false)
    @Transient
    private String epc;


    @Transient
    private long nEPCOrder;
    @Expose
    private String szISBN;
    @Transient
    private int nBooksTypeID;
    @Transient
    private int nPublishID;

    @Transient
    private String szSeriesID;

    @Transient
    private String szCardID;
    @Transient
    private String dtBorrowDate;
    @Transient
    private String dtLastRead;
    @Expose
    private String szAuthor;
    @Transient
    private double fPrice;
    @Transient
    private String dtPublishDate;
    @Transient
    private int nPages;


    @Transient
    private String szMainWord;
    @Transient
    private String szClassNO;

    @Transient
    private String szMemo;

    private String tip;

    @Transient
    private int nStartYear;
    @Transient
    private String szPublishyear;
    @Transient
    private int nConvertStaffID;
    @Transient
    private String dtConvertDate;
    @Transient
    private String nUpdateStaffID;
    @Transient
    private String dtUpdateDate;
    @Transient
    private String szMoneyType;


    @Transient
    private String szConvertStaff;
    @Transient
    private String dtAutoUpdate;
    @Transient
    private String nRenewTime;
    @Transient
    private int nBookLenType;
    @Transient
    private String szBookLen;
    @Transient
    private int nBookThickness;
    @Transient
    private int nSetInfoCount;
    @Transient
    private int nSetInfoOrder;
    @Transient
    private String szTemplibCD;
    @Transient
    private String szMedicalLib;
    @Transient
    private boolean bBookLabelChecked;


    private String remark;

    @Expose
    @Transient
    private int bLostBookFlag;//1 待查 0 正常

    public int getbLostBookFlag() {
        return bLostBookFlag;
    }

    public void setbLostBookFlag(int bLostBookFlag) {
        this.bLostBookFlag = bLostBookFlag;
    }

    @SerializedName("szPDCaseNo")
    @Transient
    private String oldShelfCode;    // 原始架位编码
    @SerializedName("szPDCaseNoTrans")
    @Expose
    @Transient
    private String oldShelfName;    // 原始架位名称
    @SerializedName("staffName")
    @Expose
    @Transient
    private String userName;
    @SerializedName("StaffID")
    @Expose
    @Transient
    private int userId;
    @SerializedName("nPDStatus")
    @Expose
    private int nPDStatus;    /// 1:正确在库  3:错库  0:初始 未盘点或未在架
    @SerializedName("nBookStatus")
    @Expose
    private int state;// 原始状态 9 =外借等等  @SerializedName("dtQDSJ")
    @SerializedName("dtRecdDate")
    @Expose
    @Transient
    private String opeationDate;    // 操作日期

    public String getOldShelfCode() {
        return oldShelfCode;
    }

    public void setOldShelfCode(String oldShelfCode) {
        this.oldShelfCode = oldShelfCode;
    }

    public String getOldShelfName() {
        return oldShelfName;
    }

    public void setOldShelfName(String oldShelfName) {
        this.oldShelfName = oldShelfName;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getOpeationDate() {
        return opeationDate;
    }

    public void setOpeationDate(String opeationDate) {
        this.opeationDate = opeationDate;
    }

    @Generated(hash = 33412149)
    public BookBean(Long Id, String tid, String shelfCode, String shelfName, String needBackDate,
            String barCode, String bookName, String callNo, String locationName, boolean forceSortCase,
            String pretendCallNo, String szBookSSID, String szISBN, String szAuthor, String tip,
            String remark, int nPDStatus, int state) {
        this.Id = Id;
        this.tid = tid;
        this.shelfCode = shelfCode;
        this.shelfName = shelfName;
        this.needBackDate = needBackDate;
        this.barCode = barCode;
        this.bookName = bookName;
        this.callNo = callNo;
        this.locationName = locationName;
        this.forceSortCase = forceSortCase;
        this.pretendCallNo = pretendCallNo;
        this.szBookSSID = szBookSSID;
        this.szISBN = szISBN;
        this.szAuthor = szAuthor;
        this.tip = tip;
        this.remark = remark;
        this.nPDStatus = nPDStatus;
        this.state = state;
    }

    @Generated(hash = 269018259)
    public BookBean() {
    }

    public Long getId() {
        return this.Id;
    }

    public void setId(Long Id) {
        this.Id = Id;
    }

    public String getTid() {
        return this.tid;
    }

    public void setTid(String tid) {
        this.tid = tid;
    }

    public String getShelfCode() {
        return this.shelfCode;
    }

    public void setShelfCode(String shelfCode) {
        this.shelfCode = shelfCode;
    }

    public void setShelfName(String shelfName) {
        this.shelfName = shelfName;
    }

    public String getNeedBackDate() {
        return this.needBackDate;
    }

    public void setNeedBackDate(String needBackDate) {
        this.needBackDate = needBackDate;
    }

    public String getBarCode() {

        if (BuildConfig.CUSTOM_MADE.equals("ShangHai_BaoWu_DangAnGuan")) {
            // TODO: 2024/1/29 上海档案馆的写法
            return this.szBookSSID;
        } else {
            return this.barCode;
        }
    }
    public String getShelfName() {
        if (shelfName == null)
            return "";
        return shelfName.equals("null") ? "" : shelfName;
    }
    public String getCallNo() {
        if (callNo == null)
            return "";
        return callNo.equals("null") ? "" : callNo;
    }


    public void setBarCode(String barCode) {

        this.barCode = barCode;
    }

    public String getBookName() {
        return this.bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }



    public void setCallNo(String callNo) {
        this.callNo = callNo;
    }

    public String getLocationName() {
        return this.locationName;
    }

    public void setLocationName(String locationName) {
        this.locationName = locationName;
    }

    public boolean getForceSortCase() {
        return this.forceSortCase;
    }

    public void setForceSortCase(boolean forceSortCase) {
        this.forceSortCase = forceSortCase;
    }

    public String getPretendCallNo() {
        return this.pretendCallNo;
    }

    public void setPretendCallNo(String pretendCallNo) {
        this.pretendCallNo = pretendCallNo;
    }

    public String getSzBookSSID() {
        return this.szBookSSID;
    }

    public void setSzBookSSID(String szBookSSID) {
        this.szBookSSID = szBookSSID;
    }

    public String getTip() {
        return this.tip;
    }

    public void setTip(String tip) {
        this.tip = tip;
    }

    public int getNPDStatus() {
        return this.nPDStatus;
    }

    public void setNPDStatus(int nPDStatus) {
        this.nPDStatus = nPDStatus;
    }

    public int getState() {
        return this.state;
    }

    public void setState(int state) {
        this.state = state;
    }

    @Override
    public BookBean clone() throws CloneNotSupportedException {
        return (BookBean) super.clone();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(this.Id);
        dest.writeString(this.tid);
        dest.writeString(this.shelfCode);
        dest.writeString(this.shelfName);
        dest.writeString(this.needBackDate);
        dest.writeString(this.barCode);
        dest.writeString(this.bookName);
        dest.writeString(this.callNo);
        dest.writeString(this.locationName);
        dest.writeByte(this.forceSortCase ? (byte) 1 : (byte) 0);
        dest.writeString(this.pretendCallNo);
        dest.writeLong(this.nEPCOrder);
        dest.writeString(this.szISBN);
        dest.writeInt(this.nBooksTypeID);
        dest.writeInt(this.nPublishID);
        dest.writeString(this.szBookSSID);
        dest.writeString(this.szSeriesID);
        dest.writeString(this.szCardID);
        dest.writeString(this.dtBorrowDate);
        dest.writeString(this.dtLastRead);
        dest.writeString(this.szAuthor);
        dest.writeDouble(this.fPrice);
        dest.writeString(this.dtPublishDate);
        dest.writeInt(this.nPages);
        dest.writeString(this.szMainWord);
        dest.writeString(this.szClassNO);
        dest.writeString(this.szMemo);
        dest.writeString(this.tip);
        dest.writeInt(this.nStartYear);
        dest.writeString(this.szPublishyear);
        dest.writeInt(this.nConvertStaffID);
        dest.writeString(this.dtConvertDate);
        dest.writeString(this.nUpdateStaffID);
        dest.writeString(this.dtUpdateDate);
        dest.writeString(this.szMoneyType);
        dest.writeString(this.szConvertStaff);
        dest.writeString(this.dtAutoUpdate);
        dest.writeString(this.nRenewTime);
        dest.writeInt(this.nBookLenType);
        dest.writeString(this.szBookLen);
        dest.writeInt(this.nBookThickness);
        dest.writeInt(this.nSetInfoCount);
        dest.writeInt(this.nSetInfoOrder);
        dest.writeString(this.szTemplibCD);
        dest.writeString(this.szMedicalLib);
        dest.writeByte(this.bBookLabelChecked ? (byte) 1 : (byte) 0);
        dest.writeInt(this.bLostBookFlag);
        dest.writeString(this.oldShelfCode);
        dest.writeString(this.oldShelfName);
        dest.writeString(this.userName);
        dest.writeInt(this.userId);
        dest.writeInt(this.nPDStatus);
        dest.writeInt(this.state);
        dest.writeString(this.opeationDate);
    }

    public void readFromParcel(Parcel source) {
        this.Id = (Long) source.readValue(Long.class.getClassLoader());
        this.tid = source.readString();
        this.shelfCode = source.readString();
        this.shelfName = source.readString();
        this.needBackDate = source.readString();
        this.barCode = source.readString();
        this.bookName = source.readString();
        this.callNo = source.readString();
        this.locationName = source.readString();
        this.forceSortCase = source.readByte() != 0;
        this.pretendCallNo = source.readString();
        this.nEPCOrder = source.readLong();
        this.szISBN = source.readString();
        this.nBooksTypeID = source.readInt();
        this.nPublishID = source.readInt();
        this.szBookSSID = source.readString();
        this.szSeriesID = source.readString();
        this.szCardID = source.readString();
        this.dtBorrowDate = source.readString();
        this.dtLastRead = source.readString();
        this.szAuthor = source.readString();
        this.fPrice = source.readDouble();
        this.dtPublishDate = source.readString();
        this.nPages = source.readInt();
        this.szMainWord = source.readString();
        this.szClassNO = source.readString();
        this.szMemo = source.readString();
        this.tip = source.readString();
        this.nStartYear = source.readInt();
        this.szPublishyear = source.readString();
        this.nConvertStaffID = source.readInt();
        this.dtConvertDate = source.readString();
        this.nUpdateStaffID = source.readString();
        this.dtUpdateDate = source.readString();
        this.szMoneyType = source.readString();
        this.szConvertStaff = source.readString();
        this.dtAutoUpdate = source.readString();
        this.nRenewTime = source.readString();
        this.nBookLenType = source.readInt();
        this.szBookLen = source.readString();
        this.nBookThickness = source.readInt();
        this.nSetInfoCount = source.readInt();
        this.nSetInfoOrder = source.readInt();
        this.szTemplibCD = source.readString();
        this.szMedicalLib = source.readString();
        this.bBookLabelChecked = source.readByte() != 0;
        this.bLostBookFlag = source.readInt();
        this.oldShelfCode = source.readString();
        this.oldShelfName = source.readString();
        this.userName = source.readString();
        this.userId = source.readInt();
        this.nPDStatus = source.readInt();
        this.state = source.readInt();
        this.opeationDate = source.readString();
    }


    public String getRemark() {
        return this.remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getSzISBN() {
        return this.szISBN;
    }

    public void setSzISBN(String szISBN) {
        this.szISBN = szISBN;
    }

    public String getSzAuthor() {
        return this.szAuthor;
    }

    public void setSzAuthor(String szAuthor) {
        this.szAuthor = szAuthor;
    }

    public String getEpc() {
        return this.epc;
    }

    public void setEpc(String epc) {
        this.epc = epc;
    }

    protected BookBean(Parcel in) {
        this.Id = (Long) in.readValue(Long.class.getClassLoader());
        this.tid = in.readString();
        this.shelfCode = in.readString();
        this.shelfName = in.readString();
        this.needBackDate = in.readString();
        this.barCode = in.readString();
        this.bookName = in.readString();
        this.callNo = in.readString();
        this.locationName = in.readString();
        this.forceSortCase = in.readByte() != 0;
        this.pretendCallNo = in.readString();
        this.nEPCOrder = in.readLong();
        this.szISBN = in.readString();
        this.nBooksTypeID = in.readInt();
        this.nPublishID = in.readInt();
        this.szBookSSID = in.readString();
        this.szSeriesID = in.readString();
        this.szCardID = in.readString();
        this.dtBorrowDate = in.readString();
        this.dtLastRead = in.readString();
        this.szAuthor = in.readString();
        this.fPrice = in.readDouble();
        this.dtPublishDate = in.readString();
        this.nPages = in.readInt();
        this.szMainWord = in.readString();
        this.szClassNO = in.readString();
        this.szMemo = in.readString();
        this.tip = in.readString();
        this.nStartYear = in.readInt();
        this.szPublishyear = in.readString();
        this.nConvertStaffID = in.readInt();
        this.dtConvertDate = in.readString();
        this.nUpdateStaffID = in.readString();
        this.dtUpdateDate = in.readString();
        this.szMoneyType = in.readString();
        this.szConvertStaff = in.readString();
        this.dtAutoUpdate = in.readString();
        this.nRenewTime = in.readString();
        this.nBookLenType = in.readInt();
        this.szBookLen = in.readString();
        this.nBookThickness = in.readInt();
        this.nSetInfoCount = in.readInt();
        this.nSetInfoOrder = in.readInt();
        this.szTemplibCD = in.readString();
        this.szMedicalLib = in.readString();
        this.bBookLabelChecked = in.readByte() != 0;
        this.bLostBookFlag = in.readInt();
        this.oldShelfCode = in.readString();
        this.oldShelfName = in.readString();
        this.userName = in.readString();
        this.userId = in.readInt();
        this.nPDStatus = in.readInt();
        this.state = in.readInt();
        this.opeationDate = in.readString();
    }

    public static final Creator<BookBean> CREATOR = new Creator<BookBean>() {
        @Override
        public BookBean createFromParcel(Parcel source) {
            return new BookBean(source);
        }

        @Override
        public BookBean[] newArray(int size) {
            return new BookBean[size];
        }
    };
}
